﻿<Window x:Class="TimeToGo.Presentation.Views.MainView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="{Binding Path=WindowTitle}" 
        Height="200" 
        Width="800">
    <Window.Resources>
        

    </Window.Resources>
    <Window.ContextMenu>
        <ContextMenu>
            <!--<MenuItem Header="Options" Command="{Binding Path=ShowOptionsCommand}" />
            <Separator />-->
            <MenuItem Header="Times" ItemsSource="{Binding Path=Times}" >
                <MenuItem.ItemContainerStyle>
                    <Style TargetType="MenuItem">
                        <Setter Property="Header" Value="{Binding Path=Name}" />
                        <Setter Property="Command" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}, Mode=FindAncestor}, Path=DataContext.SelectTimeCommand}" />
                        <Setter Property="CommandParameter" Value="{Binding Path=Name}" />
                        <Setter Property="IsCheckable" Value="True" />
                        <Setter Property="IsChecked" Value="{Binding Path=Selected}" />
                    </Style>
                </MenuItem.ItemContainerStyle>
            </MenuItem>
            <MenuItem Header="Edit times" Command="{Binding Path=EditTimesCommand}" />
            <MenuItem Header="Formatters" ItemsSource="{Binding Path=DurationFormatters}">
                <MenuItem.ItemContainerStyle>
                    <Style TargetType="MenuItem">
                        <Setter Property="Header" Value="{Binding Path=Name}" />
                        <Setter Property="Command" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}, Mode=FindAncestor}, Path=DataContext.SelectFormatCommand}" />
                        <Setter Property="CommandParameter" Value="{Binding Path=Name}" />
                        <Setter Property="IsCheckable" Value="True" />
                        <Setter Property="IsChecked" Value="{Binding Path=Selected}" />
                    </Style>
                </MenuItem.ItemContainerStyle>
            </MenuItem>
        </ContextMenu>
    </Window.ContextMenu>
    <Viewbox>
        <TextBlock Text="{Binding Path=DisplayText}" TextAlignment="Center" />
    </Viewbox>
</Window>
